home *** CD-ROM | disk | FTP | other *** search
- /************************************************************************************/
- /* KeyDownProc */
- /************************************************************************************/
-
- #include "MyHeaders.h"
-
- int KeyDownProc()
- {
- int KeyDRetCode = 0;
-
- testChar = BitAnd(myEvent.message,charCodeMask); /* get the character */
-
- if (BitAnd(myEvent.modifiers,cmdKey) != 0) /* If command key is down... */
- {
- worklong = MenuKey(testChar); /* ...find menu equivalent */
- if (worklong) /* if there is a menu equivalent */
- WorkRetCode = MenuProc(worklong); /* perform menu command */
- else
- SysBeep(0); /* otherwise just beep at em */
- }
-
- else /* else... */
- if (testChar == 0x05) /* If "help" key was used */
- WorkRetCode = HelpGetProc(); /* ...perform Help procedure */
-
- else
- {
- workWindowPtr = FrontWindow(); /* which is front (active) ? */
- WorkRetCode =
- WhichWindow(workWindowPtr, &k); /* match ptr to table */
- if (WorkRetCode == 0) /* if it's a good match */
- { /* then */
- windSub = k; /* set the subscrpt */
- switch (windTbl[windSub].windRec.refCon) /* window type */
- {
- case (ProcMain):
- WorkRetCode = MainWindowProc();
- break;
- case (ProcText):
- WorkRetCode = TextWindowProc();
- break;
- case (ProcHelp):
- WorkRetCode = HelpWindowProc();
- break;
- }
- }
- }
-
- return KeyDRetCode;
- }
-